#ifndef CDYNAMICGUIOBJECT_H_
#define CDYNAMICGUIOBJECT_H_

#include "cguiobject.h"

/**
 * CDynamicGuiObject - abstract parent class of dynamic gui objects
 * @author Michal Rost
 * @date 31.03.2008
 */
class CDynamicGuiObject : public CGuiObject {
  friend class CGuiManager;
public:
  int getFontId() const;
  CGuiStyle getStyleNormal() const;
  CGuiStyle getStylePrelight() const;
  CGuiStyle getStyleFocus() const;
  CGuiStyle getStyleDisabled() const;
  void setStyleNormal(CGuiStyle styleNormal);
  void setStylePrelight(CGuiStyle styleNormal);
  void setStyleFocus(CGuiStyle styleNormal);
  void setStyleDisabled(CGuiStyle styleNormal);
  void setDisabled(bool disabled);
  void setFontId(int fontId);
  static string getClassName() {
    return "CDynamicGuiObject";
  }
protected:
  CGuiStyle styleNormal;
  CGuiStyle stylePrelight;
  CGuiStyle styleFocus;
  CGuiStyle styleDisabled;
  int fontId;
  void init();
  virtual void keyDown(unsigned short keyId, unsigned short unicode) = 0;
  bool fitTextToWidth(string &text, unsigned short &textWidth,
      unsigned short maxWidth, CGuiRenderer* rendererPtr);
  CDynamicGuiObject* findHighestDynamicGuiObjectOwnerPtr();
  void setStyle(CGuiStyle style);
};

#endif
